package com.lhd.qd.module.system.user.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.lhd.qd.common.base.ApiResult;
import com.lhd.qd.common.base.BaseController;
import com.lhd.qd.module.system.user.model.dto.UserOperateLogPageQuery;
import com.lhd.qd.module.system.user.model.vo.UserOperateLogDetailVO;
import com.lhd.qd.module.system.user.model.vo.UserOperateLogListVO;
import com.lhd.qd.module.system.user.service.UserOperateLogService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Api(tags = "用户操作日志")
@RequestMapping("user-operate-log")
@RestController
public class UserOperateLogController extends BaseController {

    @Autowired
    private UserOperateLogService userOperateLogService;

    @ApiOperation(value = "分页列表", response = UserOperateLogListVO.class)
    @GetMapping
    public ResponseEntity<ApiResult<IPage<UserOperateLogListVO>>> pageUserOperateLog(UserOperateLogPageQuery query) {

        return success(userOperateLogService.pageUserOperateLog(query));
    }

    @ApiOperation(value = "详情", response = UserOperateLogDetailVO.class)
    @GetMapping("{id}")
    public ResponseEntity<ApiResult<UserOperateLogDetailVO>> getUserOperateLogById(@PathVariable("id") Long id) {

        return success(userOperateLogService.getUserOperateLogById(id));
    }
}
